package middleware

import (
	"fmt"

	"github.com/gin-gonic/gin"
)

type MiddlewareController struct{}

func (con MiddlewareController) MidHandler1(c *gin.Context) {
	fmt.Println("MidHandler1, start")
	c.Set("username", "zhangsan")
	c.Next()
	fmt.Println("MidHandler1, end")
}

func MidHandler2(c *gin.Context) {
	fmt.Println("MidHandler2, start")
	username, _ := c.Get("username")
	fmt.Println("username:", username)
	c.Next()
	fmt.Println("MidHandler2, end")
}
